﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCWeb.Models;

namespace MVCWeb.Controllers
{
    [HandleError]
    public class HomeController : BaseController
    {
        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Index()
        {
            ViewData["Title"] = "Home Page";
            ViewData["Message"] = "Welcome to Leisure Life.";

            ViewData["DisplayWelcome"] = "<img src='../../Images/Welcome.jpg' />";            
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult About()
        {
            ViewData["CurrentView"] = "About Leisure Life";
            return View();
        }


        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult History()
        {
            ViewData["CurrentView"] = "History of Leisure Life ";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Staffs()
        {
            ViewData["CurrentView"] = "Our Staffs &amp Company Directory";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Feedback()
        {
            ViewData["CurrentView"] = "Let Us Know How We Are Doing ...";
            return View();
        }


        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Vendor()
        {
            ViewData["CurrentView"] = "Vendor Resources";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Ads()
        {
            ViewData["CurrentView"] = "Our Associate Vendors";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult Client()
        {
            ViewData["CurrentView"] = "Log In Your Community";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult UsefulLink()
        {
            ViewData["CurrentView"] = "Useful Links";
            return View(dc.Menus.Where(m => m.Type.ToLower().Equals("usefullink")));
        }

        //[CompressFilter(Order = 1)]
        //[CacheFilter(Duration = 3600, Order = 2)]
        //public ActionResult Article()
        //{
        //    ViewData["CurrentView"] = "Association News";
        //    return View(this.dc.Articles.ToList<Article>());
        //}

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult News()
        {
            ViewData["CurrentView"] = "Leisure Life News";
            return View(this.dc.News.Where(n => n.Active == true).OrderByDescending(n=>n.PublishedDate).ToList<News>());
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult CustomerService()
        {
            ViewData["CurrentView"] = "Customer Services";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult JoinLeisureLife()
        {
            ViewData["CurrentView"] = "Let Leisure Life Manage Your Community";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 60, Order = 2)]
        public ActionResult ServiceOfferred()
        {
            ViewData["CurrentView"] = "Services Offerred";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult FAQs()
        {
            ViewData["CurrentView"] = "FAQ's";
            return View();
        }

        [CompressFilter(Order = 1)]
        [CacheFilter(Duration = 3600, Order = 2)]
        public ActionResult LegislativeUpdates()
        {
            ViewData["CurrentView"] = "Legislative Updates";
            return View(this.dc.Docs.Where(d => d.DocCategoryId == 1).OrderBy(d => d.Name).ToList<Doc>());
        }
    }
}
